'use strict';
let build = './build';
module.exports = {
  html: {
    src: [
      './src/**/*.pug',
      '!./src/components/**/*.pug'
    ],
    build: build,
    pugSet: {
      pretty: true
    }
  },
  css: {
    src: [
      './src/**/*.{scss,css}',
      '!./src/**/css/common/**/*',
      '!./src/**/css/mixin.scss',
      '!./src/**/css/var.scss',
      '!./src/**/css/sprite.scss',
      '!./src/**/css/module/**/*',
    ],
    meduleSrc: [
      './src/**/css/common/**/*',
      './src/**/css/mixin.scss',
      './src/**/css/var.scss',
      './src/**/css/module/**/*',
    ],
    build: build,
    prefixerSet: {
      browsers: ['last 100 versions'],
      cascade: false,
      remove:false
    },
    minifySet: {
      advanced: false,
      compatibility: "ie7",
      keepBreaks: true,
      keepSpecialComments: '*'
    }
  },
  js: {
    src: [
      './src/**/*.js'
    ],
    build: build
  },
  img: {
    src: [
      './src/**/*.{png,jpg,gif}',
      '!./src/**/sprite/*.{png,jpg,gif}'
    ],
    build: build
  },
  concat: {
    libSrc: [
      './src/**/main/require.js',
      './src/**/main/jquery.min.js',
      './src/**/main/flexible.js',
      './src/**/main/iconfont.js'
    ],
    libName: 'main.min.js',
    commonSrc: './src/**/common/*.js',
    commonName: 'common.min.js',
    build: 'build/assets/js/lib'
  },
  sprite: {
    src: './src/assets/img/sprite/*.png',
    build: './src/assets',
    spritesmith: {
      imgName: 'img/sprite.png',
      cssName: 'css/sprite.scss',
      padding: 5,
      algorithm: 'binary-tree',
      cssTemplate: function (data) {
        var arr=[];
        arr.push(
          '[class^="icon-"], [class*=" icon-"] {'+
          'display: inline-block'+
          ';background-image: url(' + data.spritesheet.escaped_image + ')'+
          ';background-size: ' + data.spritesheet.width/2/100 + 'rem' +
          '}\n'
        );
        data.sprites.forEach(function (sprite) {
          arr.push(".icon-"+sprite.name+
            "{" +
            "width:"+sprite.width/2/100+"rem;"+
            "height:"+sprite.height/2/100+"rem;"+
            "background-position: "+sprite.offset_x/2/100+"rem "+sprite.offset_y/2/100+"rem;"+
            "}\n");
        });
        return arr.join("");
      }
    }
  }
};
